#include<iostream>
#include<algorithm>
#include<string>

using namespace std;


bool comp(string A, string B)
{
	string temp1 = A + B, temp2 = B + A;
	if (temp1 <= temp2) return false;
	return true;
	//return A + B > B + A;
}

int main()
{
	string nums[20];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> nums[i];
	}
	sort(nums, nums + n, comp);
	for (int i = 0; i < n; i++)
	{
		cout << nums[i];
	}
	return 0;
}